<!--
  停车场表列表管理页面
  User: YanZengBao
  Date: 2020-02-19
-->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" lang="zh">
<head>
    <meta charset="utf-8"/>
    <title>停车场列表</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport"/>
    <meta content="" name="停车场表后台服务中心"/>
    <meta content="" name="GaoXiang"/>
</head>

<body class="page-content-white  fade-in-up">

<!-- BEGIN CONTAINER -->
<div class="page-container">
    <!-- BEGIN PAGE TOOLS-->
    <!--查询条件示例 使用时取消hide样式-->
    <div class="portlet ligh hide">
        <div class="portlet-title">
            <div class="caption">
                <i class="icon-paper-plane font-green-haze"></i>
                <span class="caption-subject bold font-green-haze uppercase">搜索</span>
                <span class="caption-helper">点击右侧搜索按钮开始检索</span>
            </div>
            <div class="tools">
                <a href="javascript:void(0);" class="collapse" data-original-title="收起" title="收起"></a>
                <a href="javascript:void(0);" class="fullscreen" data-original-title="全屏" title="全屏"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div class="form-inline" role="form" id="table-param-park">



                <div class="form-group form-md-line-input has-success">
                    <input type="text" class="form-control" name="name" value="" placeholder="停车场名称">
                    <div class="form-control-focus"></div>
                </div>

                <button class="btn btn-success" onclick="searchPark()"><i class="icon-magnifier"></i> 搜索</button>
                <button class="btn yellow "  onclick="reshParkList()"><i class="icon-reload"></i> 重置 </button>
            </div>
        </div>
    </div>
    <!-- END PAGE TOOLS-->

    <!-- BEGIN PAGE TABLE-->
    <div class="portlet light">
        <div class="portlet-title">
            <div class="caption">
                <i class="icon-speech  font-blue-hoki"></i>
                <span class="caption-subject font-blue-hoki">停车场数据表</span>
            </div>

            <div class="tools">
                <a href="" class="collapse" data-original-title="" title=""> </a>
                <a href="" class="fullscreen" data-original-title="" title=""> </a>
            </div>
        </div>

        <div class="portlet-body table-responsive">
            <div class="table-scrollable">
                <table class="table table-bordered table-hover" id="table_2">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>名称</th>
                        <th>类型</th>
                        <th>地址</th>
                        <th>详细地址</th>
                        <th>车位总数</th>
                        <th>剩余车位数</th>
                        <th>创建时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="data,iterStat : ${parkList}">
                        <td th:title="${data['number']}" th:text="${#strings.abbreviate(data['number'],32)}"></td>
                        <td th:title="${data['name']}" th:text="${#strings.abbreviate(data['name'],10)}"></td>
                        <td th:title="${data['parkType']}" th:text="${data['parkType'] == 0 ? '封闭停车场' : '路侧停车场'}"></td>
                        <td th:text="${data['province'] + data['city'] + data['county']}"></td>
                        <td th:title="${data['address']}" th:text="${#strings.abbreviate(data['address'],15)}"></td>
                        <td th:title="${data['parkinglotTotal']}" th:text="${data['parkinglotTotal']}"></td>
                        <td th:title="${data['parkinglotSurplus']}" th:text="${data['parkinglotSurplus']}"></td>
                        <td th:title="${#dates.format(data['createTime'],'yyyy-MM-dd HH:mm:ss')}" th:text="${#dates.format(data['createTime'],'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
                        <td>
                            <div class="btn-group btn-group-xs btn-group-solid">
                                <button th:data-id="${data['id']}" class="btn btn-danger btn-module-untying"> 解绑停车场 </button>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

        </div>
    </div>
    <!-- END PAGE TABLE-->
</div>
<!-- END CONTAINER -->
<script>

    //单个解绑点击事件
    $(".btn-module-untying").click(function () {
        try {
            var id = $(this).data("id");
        } catch (e) {
            layer.msg("执行失败！请在编辑标签上增加 data-id 列存放数据id！", {icon: 2,time:1000});
        }
        untying(id);
    });

    //单个解绑
    function untying(id) {
        var parkManagerId = `[[${parkManagerId}]]`;
        layer.confirm("确定要解绑该停车场吗？",function() {
            tools.post("/park/untyingPark", {"id":id,"parkManagerId":parkManagerId}, function (data) {
                if(data.success){
                    layer.msg(data.message, {icon: 1,time:2000},function(){
                        window.location.reload();
                    });
                }else{
                    tools.errorTip(data);
                }
            });
        });
    }
</script>
</body>
</html>